package framework.customer;

import framework.account.IAccount;

import java.util.ArrayList;
import java.util.List;


public abstract class ACustomer implements ICustomer {
    protected List<IAccount> accounts;

    public ACustomer() {
    }

    public ACustomer(String name, String street, String city, String zip, String email, String state) {
        this.name = name;
        this.street = street;
        this.city = city;
        this.zip = zip;
        this.email = email;
        this.state = state;
        accounts = new ArrayList<IAccount>();
    }

    public List<IAccount> getAccounts() {
        return accounts;
    }

    public void addAccount(IAccount acc) {
        accounts.add(acc);
        acc.setCustomer(this);
    }


    public IAccount getAccount(String accountNumber) {
        for (IAccount acc : accounts) {
            if (acc.getAccountNo().equals(accountNumber)) {
                return acc;
            }
        }
        return null;
    }


    protected String name;

    protected String street;

    protected String city;

    protected String state;

    protected String zip;

    protected String email;


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }


    public String getCity() {
        return city;
    }


    public void setCity(String city) {
        this.city = city;
    }


    public String getState() {
        return state;
    }


    public void setState(String state) {
        this.state = state;
    }


    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }


    public String getEmail() {
        return email;
    }


    public void setEmail(String email) {
        this.email = email;
    }

    public enum Type {
        COMPANY, PERSONAL
    }
}